package com.hzhjhh;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import com.hzhjhh.view.cashierView.VenditionDialog;
import com.hzhjhh.view.manageView.MainFrame;

/**
 * 超市管理系统入口
 *
 */
public class MyAppStart {

	boolean packFrame = false;

	public MyAppStart() {
        MainFrame frame = new MainFrame();
        // Validate frames that have preset sizes
        // Pack frames that have useful preferred size info, e.g. from their layout
        if (packFrame) {
        	// 向frame中添加其他组件后，pack方法可以适用新的内容
            frame.pack();
        } else {
        	// frame中的组件发生变动时，validate方法可以刷新组件布局，通常不需要手动调用，Swing会自动适用
            frame.validate();
        }

        // Center the window
//        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
//
//        Dimension frameSize = frame.getSize();
//        if (frameSize.height > screenSize.height) {
//            frameSize.height = screenSize.height;
//        }
//        if (frameSize.width > screenSize.width) {
//            frameSize.width = screenSize.width;
//        }
//        frame.setLocation((screenSize.width - frameSize.width) / 2,
//                (screenSize.height - frameSize.height) / 2);
        frame.setVisible(true);
    }

	public static void main(String[] args) {
		SwingUtilities.invokeLater(() -> {
			try {
				// 设置组件的风格，要在创建任何Swing组件之前创建
				UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			} catch (Exception exception) {
				exception.printStackTrace();
			}

			new MyAppStart();
//			VenditionDialog vendition = new VenditionDialog("超市前台收银系统");

		});
	}

}
